{if !$isTabbed}
<h1>{t 1=$form->getLabel()}Form "%s" edition{/t}</h1>
<div id="moduleTabs">
    <ul>
	<li><a href="{$URL_RELATIVE}/bo/#{url route="editStructure" tabName="structure" docId=$form->getUniqueId() docLang=$form->getLang()}" onclick="return false;"><span>{t}Edition{/t}</span></a></li>
	<li><a href="{$URL_RELATIVE}/bo/#{url route="editStructure" tabName="inbox" docId=$form->getUniqueId() docLang=$form->getLang()}" onclick="return false;"><span>{t}Inbox{/t}</span></a></li>
    </ul>
</div>
{/if}

<div id="ajaxTabLoader"><div id="loaderTabPic">{backend_image file="ajax-loader-big.gif"}</div></div>

{if $tabName == 'structure'}
<div id="tabContent">
    <form name="form" method="post" action="?module=backoffice&action=AjaxController&tabbed=true&href={url route="editStructure" tabName="structure" docId=$form->getUniqueId() docLang=$form->getLang()}" id="ajaxForm">
    <div class="submitButton"><button type="reset" class="greyButton" >{t}Cancel{/t}</button> <button type="submit" name="form[submit]" class="greenButton" >{t}Save{/t}</button></div>
    <table class="listTable">
		<tr>
            <td><br />{t}XML Structure{/t}<br /><textarea id="structure" name="form[structure]" cols="104" rows="25" class="code">{$form->getStructure()}</textarea></td>
        </tr>
    </table>
    </form>
</div>
{else if $tabName == 'inbox'}
<div id="tabContent">
{if count($records) >0}
<div id="saveButton" style="display:block">
    <ul class="saveButtons">
        <li class="first"><a href="" class="refreshTab toolTip linkButton active" title="">{icon name="refresh.png"} {t}Refresh{/t}</a></li>
        <li><a href="{$URL_RELATIVE}/bo/#{url route='inboxSettings' docId=$form->getUniqueId() docLang=$form->getLang()}" class="nyroModal toolTip linkButton active" title="">{icon name="engine.png"} {t}Inbox settings{/t}</a></li>
    </ul>
</div>
{if !$form->hasSaveAction()}
<div id="pagination">{icon name="warning.png"} {t}Save action is disabled{/t}</div>
{/if}
<div id="pagination"><!-- {t}Select{/t} : {t}All{/t}, {t}None{/t}, {t}Read{/t}, {t}Unread{/t} | -->{block module="backoffice" action="AjaxPagination"  nbDocTot=$pagination.nbDocTot nbDoc=$pagination.nbDoc numPage=$pagination.numPage}<div id="selectedelements"></div></div>
    <table class="documentListTable">
        <thead>
            <tr>
                <th style="width: 90px;"></th>
                {foreach from=$form->getListFields() item=field}
                    {if $field.visible == true}
                        <th>{$field.label}</th>
                    {/if}
                {/foreach}
                <th>{t}Date{/t}</th>
            </tr>
        </thead>
        <tbody class="documentListItems">
            {foreach from=$records item=record}
            <tr{if $record->getPublicationStatus() == 'NEW'} class="bold"{else} class="light"{/if}>
                <td>
                    <input class="select" type="checkbox" name="" />
                    {if $record->getPublicationStatus() == 'NEW'}{icon name="status/PUBLISHED.png" class="icon"}{else}{icon name="status/UNPUBLISHED.png" class="icon"}{/if}
                    <span class="listButtons">
                        <a href="{$URL_RELATIVE}/bo/#{url route='showRecord' docId=$record->getUniqueId() docLang=$record->getLang()}" class="itemButton itemViewButton defaultAction openInTab toolTip" title=""></a>
                        <a href="{$URL_RELATIVE}/bo/#{url route='deleteGeneric' moduleName='form' docId=$record->getUniqueId() docLang=$record->getLang()}&refresh=1" class="itemButton itemDeleteButton nyroModal toolTip" title=""></a>
                    </span>
                </td>
                {foreach from=$form->getListFields() item=field}
                    {if $field.visible == true}
                        {if $field.type == 'textarea'}
                            <td>{$record->getFormValue($field.name)|truncateAtWord:50:'...'}</td>
                        {else}
                            <td>{$record->getFormValue($field.name)}</td>
                        {/if}
                    {/if}
                {/foreach}
                <td>{$record->getCreationDate()|elapsed}</td>
            </tr>
            {/foreach}
        </tbody>
    </table>
    {else}
    <div class="emptyFolder">
        {if !$form->hasSaveAction()}
            {icon name="info.png"} {t}Form values recording is not active.{/t}
        {else}
            {icon name="info.png"} {t}No records found.{/t}
        {/if}
    </div>
    {/if}
</div>
{/if}